<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>程序转移_风尚淘客程序</title>
<link href="../admin/Css/Style.css" rel="stylesheet" type="text/css" />
</head>
<?php
include("../config.php");
include("../model/function.php");

function dropAllTable(){
	global $prefix;

	if(!mysql_query("drop table if exists ".$prefix."ad,".$prefix."app,".$prefix."article,".$prefix."artset,".$prefix."column,".$prefix."haodian,".$prefix."haodiantype,".$prefix."link,".$prefix."newshop,".$prefix."member,".$prefix."product,".$prefix."shopcat,".$prefix."shoplist,".$prefix."websetting,".$prefix."searchkey")){
		echo("程序出错，请联系客服，QQ：249917210");
		exit();
	}
	
}

if($_POST['Submits']){
	$do=file_get("http://www.fengsh8.com/sqm/check_sqm.php?username=".$_POST['username']."&appSecret=".$_POST['appsecret']."&domain=".$_SERVER['SERVER_NAME']."&t=1");
	if($do){
		echo $do;
		exit();
	}else{
		$xml=file_get("http://www.fengsh8.com/sqm/check_sqm.php?username=".$_REQUEST['username']."&appSecret=".$_REQUEST['appSecret']."&t=1");
		if(!$fp = fopen("temp.xml", "wa")){     
		   showinfo("请将install目录的权限设置为可写或者777后重试！");  
		   return false;
		}     
		if(!fwrite($fp, $xml)){     
		   showinfo("写入失败，请联系技术人员进行修改！");    
		   fclose($fp); 
		   unlink("temp.xml");
		   return false;
		}             
		fclose($fp);     
		
		$dom = new DomDocument(); 
		$dom->load("temp.xml");
		$return = $dom->getElementsByTagName("status")->item(0)->nodeValue ; 
		if($return==0){
			echo "对不起，您的账号未绑定任何授权码,获取授权客服QQ：249917210";
		}elseif($return==1){
			echo "程序出错，请客服QQ：249917210";
		}else{
			dropAllTable();
			if(mysql_error()){
				file_get("http://www.fengsh8.com/sqm/check_sqm.php?username=".$_POST['username']."&appSecret=".$_POST['appsecret']."&domain=".$_SERVER['SERVER_NAME']."&t=1&su=1");
				echo "程序出错，请客服QQ：249917210";
			}else{
				echo "配置完成，您可以把现在空间中的程序转移到新的空间后重新安装。";
				rename("code.pfx.lock",'code.pfx');
			}
		}
	}
}
?>
<script language="javascript">
function subs(){
	if(document.getElementById('username').value==''){alert("淘宝用户名不能为空");return false;}
	if(document.getElementById('appsecret').value==''){alert("appsecret不能为空");return false;}
	return confirm('确认要转移空间？\n转移后原来空间的程序将不能再运行');
}
</script>
<body>
<div id="LoginLogo"></div>
<div id="LoginTop">
	<div class="BarLeft"></div>
    <div id="LoginTopText">程序转移</div>
    <div class="BarRight"></div>
    <div class="Cal"></div>
</div>
<form id="AdminLogin" name="AdminLogin" method="post" action="" onsubmit="return subs();">
<div id="LoginBox">
    <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="25">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td height="35" align="right" class="FontWeight">用户名：</td>
          <td><input name="username" type="text" class="Input" id="username" /></td>
      </tr>
        <tr>
          <td height="35" align="right" class="FontWeight">appsecret：</td>
          <td><input name="appsecret" type="password" class="Input" id="appsecret" /></td>
        </tr>
        <tr>
          <td height="10" colspan="2" align="center"></td>
      </tr>
        <tr>
            <td height="40" colspan="2" align="center"><input name="Submits" type="submit" class="Button" id="Submits" value="提交" />              &nbsp;&nbsp;<input name="ReSet" type="reset" class="Button" id="ReSet" value="重置" /></td>
        </tr>
        <tr>
            <td height="25" colspan="2" align="right" class="Font999">程序购买（QQ）：249917210</td>
        </tr>
    </table>
</div>
</form>
</body>
</html>